package com.bs.jianli.util.security;

import com.bs.jianli.entity.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
 * @author 小姚
 * @pakeageName:com.bs.manager05.utils.security
 * @ClassName:LoginUser
 * @Descirption:
 * @data 2022/12/21 14:18
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LoginUser implements UserDetails {

    private User user;

    @Override
    //当前用户的权限集合
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    //用户密码
    @Override
    public String getPassword() {
        return user.getPassword();
    }

    //用户名
    @Override
    public String getUsername() {
        return user.getUsername();
    }
//登录是否过期
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    //账号是否不为锁定状态
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    //状态是否可用
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    //状态是否可用
    @Override
    public boolean isEnabled() {
        return true;
    }
}
